<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div> 123 </div>
    <div id="box1"> 123 </div>
    <div class="box"> 123 </div>
    
    <script>
       //querySelectorAll获取全部选择的全部元素  返回的是一个集合
        var tags = document.querySelectorAll('.box')
        console.log(tags)
        var idtags = document.querySelectorAll('#box1')  
        console.log(idtags)
        var classtags = document.querySelectorAll('div')  
        console.log(classtags)

        //querySelector 获取选择的第一个元素
        var tag = document.querySelector('.box')
        console.log(tag)
        var idtag = document.querySelector('#box1')  
        console.log(idtag)
        var classtag = document.querySelector('div')  
        console.log(classtag)
    </script>
</body>
</html>